package com.cobra.rdd.operator.action

import org.apache.spark.{SparkConf, SparkContext}

object Spark12_RDD_Operator_foreach {
  def main(args: Array[String]): Unit = {

    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("Spark12_RDD_Operator_foreach")
    val sc = new SparkContext(sparkConf)
    val rdd = sc.makeRDD(List(
   1,2,3,4
    ))
    //foreach其实是Driver段内存集合的循环遍历方法
    rdd.collect().foreach(println)
    println("==================")
    //foreach其实是Executor端内存打印
    rdd.foreach(println)
    sc.stop()
  }
}
